
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <librally.h>

typedef struct {
	int fd_svr;
	struct sockaddr_in addr_svr;
} Global;

Global global;

void global_init()
{
	global.addr_svr.sin_family = AF_INET;
	global.addr_svr.sin_family = AF_INET;
	global.addr_svr.sin_port = htons(8888);
	global.addr_svr.sin_addr.s_addr = inet_addr("127.0.0.1");
	memset(&global.addr_svr.sin_zero, 0, 8);
}

int main()
{
	Err err;
	int clifd;
	char *sendmsg = "Test";
	char recvmsg[8];
	
	global_init();
	err = rp_comm_tcp_client_init(&global.fd_svr, &global.addr_svr);
	err = rp_comm_send(global.fd_svr, sendmsg, 8);
	err = rp_comm_recv(global.fd_svr, recvmsg, 8);
	printf("msg = %s\n", recvmsg);
	close(global.fd_svr);
		
	exit(0);
}

